using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Data;
using PlugNT.Safe;
using PlugNT.Custom;
using PlugNT.Cms.Model;
//5^1^a^s^p^x
namespace PlugNT.Cms.BLL
{



    public class Channel
    {

        private static readonly PlugNT.Cms.DAL.Channel dal = new PlugNT.Cms.DAL.Channel();






        public DataTable GetNavigation1(string clsno)
        {
            return dal.GetNavigation1(clsno);
        }


        public string GetClsno(int id)
        {
            return dal.GetClsno(id);

        }












        internal static string ExtGetClslistByNo(string clsno, bool hasIsmap)
        {
            return dal.GetClslistByClsno(StringHelper.SqlFilter(clsno), hasIsmap);
        }



        public DataTable GetChannelByParentNo(int topCount, string parentNo)
        {
            return dal.GetChannelByParentNo(topCount, parentNo);
        }


        public string GetClslistByClsno(string clsno, bool hasIsmap)
        {
            return dal.GetClslistByClsno(StringHelper.SqlFilter(clsno), hasIsmap);
        }







        public string GetClsnameByParentNo(string clsno)
        {
            return dal.GetClsnameByParentNo(StringHelper.SqlFilter(clsno));
        }






        public string GetParentClsno(string clsno)
        {
            return dal.GetParentClsno(StringHelper.SqlFilter(clsno));
        }






        public string GetCreatepath(string clsno)
        {
            return dal.GetCreatepath(StringHelper.SqlFilter(clsno));
        }






        public string GetNavigation(string clsno)
        {
            StringBuilder sb = new StringBuilder();
            DataTable dt = dal.GetNavigation1(clsno);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i <= dt.Rows.Count - 1; i++)
                {
                    DataRow dr = dt.Rows[i];

                    sb.Append("<li>&nbsp;<a href=\"Articles.aspx?clsno=" + dr["clsno"].ToString() + "\">");
                    if (i == dt.Rows.Count - 1)
                    {
                        sb.Append("<strong>");
                        sb.Append(dr["clsname"].ToString());
                        sb.Append("</strong>");
                    }
                    else
                    {
                        sb.Append(dr["clsname"].ToString());
                    }
                    sb.Append("</a>&nbsp;</li>");
                    sb.Append(">");
                }
                return sb.ToString().TrimEnd('>');
            }
            return "";
        }









        public ChannelInfo GetChannelInfo(string clsno)
        {
            return dal.GetChannelInfo(StringHelper.SqlFilter(clsno));

        }






        public DataTable GetChannelTable(string clsno)
        {
            return dal.GetChannelTable(StringHelper.SqlFilter(clsno));
        }









        public bool Add(ChannelInfo model)
        {
            return dal.Add(model);
        }







        public bool Update(ChannelInfo model, bool isSubModel)
        {
            return dal.Update(model, isSubModel);
        }






        public bool Delete(string clsno)
        {
            return dal.Delete(StringHelper.SqlFilter(clsno));
        }


        internal static bool ExtParentExists(string clsno)
        {
            return dal.ParentExists(StringHelper.SqlFilter(clsno));
        }


        public bool ClsnoExists(string clsno)
        {
            return dal.ClsnoExists(StringHelper.SqlFilter(clsno));
        }


        public bool ParentExists(string clsno)
        {
            return dal.ParentExists(StringHelper.SqlFilter(clsno));
        }





        public DataTable GetList()
        {
            return dal.GetList();
        }






        public DataTable GetOrderList()
        {
            return dal.GetOrderList();
        }

        public DataTable GetOrderList(string clslist)
        {
            return dal.GetOrderList(clslist.Trim());
        }







        public DataTable GetListRow(string clsno)
        {
            return dal.GetListRow(StringHelper.SqlFilter(clsno));

        }






        public DataTable GetOrderSubList(string clsno)
        {
            return dal.GetOrderSubList(StringHelper.SqlFilter(clsno));

        }



        public string Help()
        {
            return @"mailto:354990393@qq.com";
        }


    }

}
